package com.lanou.myim.ui.activity;

import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatButton;
import android.support.v7.widget.AppCompatEditText;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
import android.widget.ImageView;

import com.lanou.myim.R;
import com.lanou.myim.tools.CreateQRCode;

/**
 * Created by dllo on 16/3/11.
 */
public class CreateQRCodeActivity extends BaseActivity{
    private AppCompatEditText etContent;
    private AppCompatTextView tvCreate;
    private ImageView imgShow;
    private String userName;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_createcode);

        tvCreate = (AppCompatTextView) findViewById(R.id.tv_create);
        imgShow = (ImageView) findViewById(R.id.img_show);
        Intent intent =getIntent();
        userName = intent.getStringExtra("userName");
        tvCreate.setText(userName);
                createQRImage(userName);

    }

    private void createQRImage(String content) {
        CreateQRCode.createQRImage(content, "test", new CreateQRCode.OnCreateQRListener() {
            @Override
            public void onSuccess(Bitmap qrImage) {
                imgShow.setImageBitmap(qrImage);
            }
        });
    }
}


